/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uimigration.uipositionning.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import uimigration.uipositionning.NestedIn;
import uimigration.uipositionning.NestedPositionType;
import uimigration.uipositionning.UipositionningPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Nested In</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link uimigration.uipositionning.impl.NestedInImpl#getNestedPosition <em>Nested Position</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class NestedInImpl extends RelativeImpl implements NestedIn {
	/**
	 * The default value of the '{@link #getNestedPosition() <em>Nested Position</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNestedPosition()
	 * @generated
	 * @ordered
	 */
	protected static final NestedPositionType NESTED_POSITION_EDEFAULT = NestedPositionType.CENTER;

	/**
	 * The cached value of the '{@link #getNestedPosition() <em>Nested Position</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNestedPosition()
	 * @generated
	 * @ordered
	 */
	protected NestedPositionType nestedPosition = NESTED_POSITION_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected NestedInImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return UipositionningPackage.Literals.NESTED_IN;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NestedPositionType getNestedPosition() {
		return nestedPosition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNestedPosition(NestedPositionType newNestedPosition) {
		NestedPositionType oldNestedPosition = nestedPosition;
		nestedPosition = newNestedPosition == null ? NESTED_POSITION_EDEFAULT : newNestedPosition;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, UipositionningPackage.NESTED_IN__NESTED_POSITION, oldNestedPosition, nestedPosition));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case UipositionningPackage.NESTED_IN__NESTED_POSITION:
				return getNestedPosition();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case UipositionningPackage.NESTED_IN__NESTED_POSITION:
				setNestedPosition((NestedPositionType)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case UipositionningPackage.NESTED_IN__NESTED_POSITION:
				setNestedPosition(NESTED_POSITION_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case UipositionningPackage.NESTED_IN__NESTED_POSITION:
				return nestedPosition != NESTED_POSITION_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (nestedPosition: ");
		result.append(nestedPosition);
		result.append(')');
		return result.toString();
	}

} //NestedInImpl
